#!/bin/bash
#written by wupan@2016-10-19

#监听3306端口
port=`netstat -nlt|grep 3306|wc -l`
#查看mysqld进程
process=`ps -ef |grep mysql|grep -v "grep" |wc -l`

if [ "1" -eq $port ] && [ "0" -ne $process ]; then
    echo `date +%F-%T` "- MySQL is running..." >> check_mysql.log
else
    echo `date +%F-%T` "- MySQL is stop, restart..." >> check_mysql.log
    /opt/zbox/zbox start
fi
